import request from '@/utils/request'

export function queryPage(query) {
  return request({
    url: '/user/page',
    method: 'post',
    params: {
      current: query.page,
      size: query.size,
      orgId: query.orgId,
      roleName: query.roleName,
      deptName: query.deptName,
      nickName: query.nickName
    }
  })
}

export function create(temp) {
  return request({
    url: 'user/add',
    method: 'post',
    data: temp
  })
}

export function update(temp) {
  return request({
    url: 'user/update',
    method: 'post',
    data: temp
  })
}

export function deleteById(username) {
  return request({
    url: 'user/' + username,
    method: 'delete'
  })
}

export function changePassword(temp) {
  return request({
    url: 'user/change-pwd',
    method: 'post',
    params: {
      username: temp.username,
      newPassword: temp.newPassword,
      oldPassword: temp.oldPassword
    }
  })
}
